
public class Test1 {


    public static void main(String[] args) throws InterruptedException {
       Thread t1 = new Thread(()->{
             while (!Thread.currentThread().isInterrupted()){
                 System.out.println("t1执行中");
                 try {
                     Thread.sleep(2000);
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                     break ;
                 }
             }
       },"t1");
       t1.start();
        System.out.println("4庙后t1停止");
        Thread.sleep(4000);
       t1.interrupt();
        System.out.println(t1.isInterrupted());
        Thread.sleep(1000);
        System.out.println(t1.isInterrupted());

    }
}
